package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.algorithm.CannyEdgeDetector;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * Canny边缘检测算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建CannyEdgeDetector实例
 */
public class CannyEdgeDetectorFactory implements AlgorithmExecutorFactory {
    private static final CannyEdgeDetectorFactory instance = new CannyEdgeDetectorFactory();

    private CannyEdgeDetectorFactory() {}
    
    /**
     * 获取工厂实例
     * @return CannyEdgeDetectorFactory实例
     */
    public static CannyEdgeDetectorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        CannyEdgeDetector cannyEdgeDetector = new CannyEdgeDetector();
        BeanUtils.copyProperties(param, cannyEdgeDetector);
        return cannyEdgeDetector;
    }
}
